<template>
  <div>
    <el-form label-width="100px">
      <el-row type="flex" justify="evenly">
        <el-form-item label="一体杆名称">
          <el-input placeholder="请输入一体杆名称" />
        </el-form-item>

        <el-form-item label="一体杆编号">
          <el-input placeholder="请输入一体杆编号" />
        </el-form-item>

        <el-form-item label="处置状态">
          <el-select placeholder="请选择处置状态">
            <el-option label="全部" :value="0" />
            <el-option label="未派单" :value="1" />
            <el-option label="已派单" :value="2" />
            <el-option label="已接单" :value="3" />
            <el-option label="已完成" :value="4" />
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button type="primary">查询</el-button>
        </el-form-item>
      </el-row>

    </el-form>

    <el-table
      style="width: 100%"
      :data="data"
    >
      <el-table-column
        type="selection"
        width="55"
      />
      <el-table-column
        label="序号"
        type="index"
        width="180"
      />
      <el-table-column
        prop="poleName"
        label="一体杆名称"
        width="180"
      />
      <el-table-column
        prop="poleNumber"
        label="一体杆编号"
      />
      <el-table-column
        prop="errorType"
        label="故障类型"
      />
      <el-table-column
        prop="handleStatus"
        label="处置状态"
      />
      <el-table-column
        prop="warningTime"
        label="告警时间"
      />

      <el-table-column
        prop="demoFlag"
        label="操作"
      >
        <template>
          <el-button type="text" size="small">派单</el-button>
          <el-button type="text" size="small">详情</el-button>
          <el-button type="text" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <div class="block" style="float:right">
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20,50,100]"
        layout="total,prev,pager,next,sizes"
        :total="total"
        :page-size="10"
        @size-change="onSizeChange"
        @current-change="onCurrentChange"
      />

    </div>

  </div>
</template>

<script>
import { getAlarmAPI } from '@/api/alarm'

export default {
  data() {
    return {
      data: [],
      page: 1,
      pageSize: 10,
      total: 0

    }
  },
  created() {
    this.onLoad()
  },
  methods: {
    async  onLoad() {
      const res = await getAlarmAPI({ page: this.page, pageSize: this.pageSize })
      this.data = res.data.rows
      this.total = res.data.total
    },
    onCurrentChange(page) {
      this.page = page
      this.onLoad()
    },
    onSizeChange(page) {
      this.pageSize = page
      this.onLoad()
      this.page = 1
    }
  }
}
</script>

  <style>

  </style>
